
// 查用户收藏文章列表
export const listCollectApi = async (pageNum, pageSize) => {
	const {
		data: res
	} = await uni.$http.get(`/api/userArticle/listByPage?pageNum=${pageNum}&pageSize=${pageSize}`)
	return res
}

// 新增、编辑文章
export const addOrUpdateApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post(`/api/article/addOrUpdate`, data)
	return res
}
// 增加观看量
export const addViewByIdApi = async (id) => {
	const {
		data: res
	} = await uni.$http.get(`/api/article/addViewById/${id}`)
	return res
}
// 删除文章
export const deleteByIdApi = async (id) => {
	const {
		data: res
	} = await uni.$http.delete(`/api/article/deleteById/${id}`)
	return res
}
// 分页查文章
export const queryListByPageApi = async (params) => {
	const projectCode = uni.getStorageSync('ylProject').projectCode
	const {
		data: res
	} = await uni.$http.post(`/api/article/queryListByPage`, {...params, projectCode})
	return res
}
// 分类列表
export const queryCategoryListApi = async (name) => {
	const {
		data: res
	} = await uni.$http.post(`/api/materialCategory/queryListByPage?name=${name}&pageNum=1&pageSize=9999&type=3`)
	return res
}

// 文章评论
export const addCommentApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post(`/api/discuss/add`, data)
	return res
}
// 根据文章查评论
export const findByArticleIdApi = async (articleId) => {
	const {
		data: res
	} = await uni.$http.post(`/api/discuss/findByArticleId/${articleId}`)
	return res
}

// 收藏文章
export const userArticleSaveApi = async (articleId) => {
	const {
		data: res
	} = await uni.$http.post(`/api/userArticle/save?articleId=${articleId}`)
	return res
}
// 批量删除收藏文章记录
export const userArticleDeleteApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post(`/api/userArticle/deleteBatch`, data)
	return res
}

// 详情/article/queryById/{id}

export const articleDetailApi = async (id) => {
	const {
		data: res
	} = await uni.$http.get(`/api/article/queryById/${id}`)
	return res
}

